engine: fail startup when HTTP server cannot start - #12176
Conversation
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughFluent Bit now fails startup when the internal HTTP server cannot be created or started. An integration test occupies the monitoring port and verifies startup raises an error and exits non-zero. ChangesHTTP startup failure handling
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a3b358e236
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| config->http_ctx = flb_hs_create(config->http_listen, config->http_port, | ||
| config); | ||
| flb_hs_start(config->http_ctx); | ||
| if (!config->http_ctx) { |
There was a problem hiding this comment.
The reviewed commit message has no Signed-off-by trailer, so it does not satisfy this repository's mandatory DCO policy and may be rejected during contribution checks; recreate the commit with an appropriate sign-off before submission.
AGENTS.md reference: AGENTS.md:L140-L140
Useful? React with 👍 / 👎.
| service.stop() | ||
|
|
||
|
|
||
| def test_internal_http_server_bind_failure_fails_startup(monkeypatch): |
There was a problem hiding this comment.
Split the integration coverage into a separate commit
This commit combines the engine implementation in src/flb_engine.c with Python integration-suite changes, although repository branch practice requires core plumbing and integration tests to be committed separately; split the implementation and regression coverage into component-scoped commits before submission.
AGENTS.md reference: AGENTS.md:L167-L172
Useful? React with 👍 / 👎.
Problem
When the built-in HTTP server is enabled but cannot bind its configured address or port, Fluent Bit logs the listener error and continues running without its health and metrics endpoints.
Fixes #12167.
Root cause
flb_engine_start()created and started the HTTP server without checking either operation's return value. A listener bind failure was therefore discarded and the engine still announced successful startup.Changes
User impact
Configurations that explicitly enable the built-in HTTP server will no longer run in a partially initialized state when that server is unavailable. A bind failure now causes a non-zero process exit so supervisors and container runtimes can detect the startup failure.
Validation
tests/integration/.venv/bin/python -m pytest tests/integration/scenarios/internal_http_server/tests/test_internal_http_server_001.py -q— 4 passedVALGRIND=1 VALGRIND_STRICT=1 tests/integration/.venv/bin/python -m pytest tests/integration/scenarios/internal_http_server/tests/test_internal_http_server_001.py -q— 4 passed, strict valgrind cleanctest --test-dir build -R '^flb-it-http_server$' --output-on-failure— passedmaster— passedSummary by CodeRabbit
Bug Fixes
Tests